home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15570 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: ix.netcom.com!news
  2. From: jhewett@ix.netcom.com (Jerry Hewett)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Begging for help! Desperate!
  5. Date: Sat, 06 Apr 96 18:13:12 GMT
  6. Organization: Netcom
  7. Message-ID: <N.040696.101312.44@ix.netcom.com>
  8. References: <4k4il4$ccr@cronkite.seas.gwu.edu>
  9. NNTP-Posting-Host: tem-ca1-18.ix.netcom.com
  10. X-NETCOM-Date: Sat Apr 06 12:11:25 PM CST 1996
  11. X-Newsreader: Quarterdeck Message Center [2.00]
  12.  
  13. Karim P. Draoui <kelly@seas.gwu.edu> asks:
  14.  
  15. > I am trying to close a window in a program I am creating in Borland C++ 4.5.
  16. > Basically what I am trying to do is open another window and close the current
  17. > window.  I am having problems though using the CloseWindow function.  I am
  18. > able to open another window, but I cannot close the current window.  I have
  19. > used the books that come with Borland, but with no luck.  Anyways, if anyone
  20. > can help me out as soon as possible I would really appreciate it.
  21.  
  22. If I could look at your code I might be able to help you out with this.  At 
  23. this point I'm guessing that the windows in question are child windows and not 
  24. the parent window for your application (which would explain why things aren't 
  25. quite working right :-).  If so, try trapping on the WM_CLOSE case in your 
  26. WinProc and sending out a DestroyWindow command.  You'll still need to send the 
  27. WM_CLOSE message to your window, though:
  28.  
  29.     SendMessage (handle_to_your_first_window,WM_CLOSE,0,0);
  30.     .
  31.     .
  32.     .
  33.     case WM_CLOSE:
  34.         DestroyWindow (handle_to_your_first_window);
  35.         handle_to_your_first_window = 0;
  36.         break;
  37.  
  38. Depending on how your program is put together, there might be a bit more 
  39. involved with destroying the first window.
  40.  
  41. Advice that I consistantly offer to folks that want to write Windows apps -- 
  42. buy a copy of _Programming Windows_ by Charles Petzold (Microsoft Press).  It's 
  43. still the best intro and general reference available for Windows developers.
  44.  
  45. Jerry H.
  46.  
  47.  
  48.